package cn.lg.soar.system.biz.modules.auth.model;

import cn.lg.soar.common.data.tree.ITreeResult;
import cn.lg.soar.system.biz.modules.auth.entity.Menu;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.List;

/**
 * 菜单树形数据
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Getter
@Setter
public class MenuTree implements ITreeResult<MenuTree>, Serializable {

    private static final long serialVersionUID = -2670893230367311406L;

    private Long id;

    private Integer type;

    private String code;

    private String path;

    private String redirect;

    private String component;

    private String title;

    private String icon;

    private Integer status;

    private Boolean hideChildren;

    private Boolean shared;

    private Boolean keepalive;

    private Integer sort;

    private List<MenuTree> children;

    public MenuTree() {
    }

    public MenuTree(Menu menu) {
        if (menu != null) {
            this.id = menu.getId();
            this.type = menu.getType();
            this.code = menu.getCode();
            this.path = menu.getPath();
            this.redirect = menu.getRedirect();
            this.component = menu.getComponent();
            this.title = menu.getTitle();
            this.icon = menu.getIcon();
            this.status = menu.getStatus();
            this.hideChildren = menu.getHideChildren();
            this.shared = menu.getShared();
            this.keepalive = menu.getKeepalive();
            this.sort = menu.getSort();
        }
    }

}
